﻿@model Event

@{
    ViewBag.Title = "Redigér " + @Model.Name;
    var selected = string.Empty;
}

<div class="page-header">
    <h1><span class="glyphicon glyphicon-calendar"></span> @ViewBag.Title</h1>
</div>
@if (!ViewData.ModelState.IsValid)
{
    <div class="alert alert-danger alert-dismissable">
        <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
        @Html.ValidationSummary("", new { @style = "color: #fff;" })
    </div>
}

@using (Html.BeginForm("Edit", "Event", FormMethod.Post, new { role = "form", @class = "form-horizontal" }))
{
    @Html.AntiForgeryToken()

    @Html.HiddenFor(m => m.Id)
    @Html.HiddenFor(m => m.uuid)
    @Html.HiddenFor(m => m.PlayerId)
    @Html.HiddenFor(m => m.LegacyCourseUuid)
    @Html.HiddenFor(m => m.LegacyOwnerUuid)
    @Html.HiddenFor(m => m.EndDate)
    @Html.HiddenFor(m => m.IsTeeTimeBooked)
                
    @Html.EditorFor(x=>x.StartDate)

    <div class="form-group">
        <label class="col-sm-2 control-label">kategori</label>
        <div class="col-sm-9">
            <select class="form-control" id="EventTypeId" name="EventTypeId">
                <option value="2">Almindelig match</option>
                <option value="1">Major</option>
                <option value="4">Social event</option>
            </select>
        </div>
    </div>

    <div class="form-group">
        <label for="Name" class="col-sm-2 control-label">navn</label>
        <div class="col-sm-9">
            <input type="text" id="Name" name="Name" class="form-control" required value="@Model.Name" placeholder="Find på et godt navn til eventet">
        </div>
    </div>
    <div class="form-group">
        <label for="Content" class="col-sm-2 control-label">beskrivelse</label>
        <div class="col-sm-9">
            <textarea id="Content" name="Content" rows="5" cols="25" class="form-control" required placeholder="Skriv en god og fyldestgørende beskrivelse af eventet">@Model.Content</textarea>
        </div>
    </div>
    <div class="form-group">
        <label for="CourseId" class="col-sm-2 control-label">klub</label>
        <div class="col-sm-6">
            <div class="input-group">
                <span class="input-group-addon"><span class="glyphicon glyphicon-home"></span></span>
                @Html.DropDownListFor(m => m.CourseId, new SelectList(ViewBag.Courses, "Id", "Name"), "Vælg bane..", new { @class = "form-control" })
            </div>
        </div>
    </div>
    <div class="form-group">
        <label for="Location" class="col-sm-2 control-label">hvor?</label>
        <div class="col-sm-9">
            <input type="text" id="Location" name="Location" class="form-control" placeholder="Angiv adresse eller lign for eventet, hvis ikke der vælges en klub" value="@Model.Location">
        </div>
    </div>

    <div class="form-group">
        <label for="JoinByDate" class="col-sm-2 control-label">tilmeld pr.</label>
        <div class="col-sm-3">
            <div class="input-group">
                <span class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span></span>
                <input type="text" id="JoinByDate" name="JoinByDate" required class="form-control datepicker" value="@Model.JoinByDate.GetValueOrDefault().Date.ToShortDateString()">
            </div>
        </div>
    </div>
    
    @Html.EditorFor(x=>x.MeetingTime)
            
    @Html.EditorFor(x=>x.StartingTime)
    
    <div class="form-group">
        <label for="EntryFee" class="col-sm-2 control-label">matchfee</label>
        <div class="col-sm-2">
            <div class="input-group">
                <span class="input-group-addon">kr.</span>
                <input type="number" id="EntryFee" name="EntryFee" class="form-control" value="@Model.EntryFee" placeholder="valgfrit">
            </div>
        </div>
    </div>
    <div class="form-group">
        <label for="create" class="col-sm-2 control-label"></label>
        <div class="col-sm-11">
            <button type="submit" class="btn btn-default">Gem</button>
        </div>
    </div>
}

@section Scripts {
    @Scripts.Render("~/bundles/globalize")
    @Scripts.Render("~/bundles/jqueryval")
    @Scripts.Render("~/Scripts/_thecup_editing.js")
}
